package leetCode.fourthWeek;

class ListNode {
  int val;
  ListNode next;

  ListNode(int x) {
    val = x;
  }
}

public class Code_83 {

  public ListNode deleteDuplicates(ListNode head) {
    if (head == null) {
      return head;
    }
    ListNode tmp = head;
    while (tmp.next != null) {
      if (tmp.val == tmp.next.val) {
        tmp.next = tmp.next.next;
      } else {
        tmp = tmp.next;
      }
    }
    return head;
  }
}
